<template>
  <div class="time">
    <div class="count" @click="handleStep">
      <span>{{ count }}跳过</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Action',
  data() {
    return {
      count: '',
    }
  },
  created() {
    this.threeGo()
  },
  methods: {
    threeGo() {
      const TIME_COUNT = 3
      if (!this.timer) {
        this.count = TIME_COUNT
        this.show = false
        this.timer = setInterval(() => {
          if (this.count > 0 && this.count <= TIME_COUNT) {
            this.count--
          } else {
            this.show = true
            clearInterval(this.timer)
            this.timer = null
            this.$router.push({
              path: '/home/in_theaters',
            })
          }
        }, 1000)
      }
    },
    handleStep() {
      this.$router.push('/home/in_theaters')
    },
  },
}
</script>

<style scoped>
.time {
  width: 100vw;
  height: 100vh;
  background-image: url('@/assets/images/二十大2.jpg');
  background-size: 100% 100%;
  overflow: hidden;
  box-sizing: border-box;
  position: relative;
}
.count {
  position: absolute;
  width: 75px;
  text-align: center;
  height: 35px;
  line-height: 35px;
  background-color: rgba(169, 169, 169, 0.6);
  border-radius: 5px;
  top: 5%;
  right: 7%;
}
span {
  font-size: 17px;
  color: aliceblue;
}
</style>
